Skip to content

Conversation

@AmelBawa-msft
Copy link
Contributor

@AmelBawa-msft AmelBawa-msft commented Sep 8, 2025

  • Register for the user (when appropriate) after Repair -AllUsers

    Register AppInstaller when using AddProvisionPackageAsync which was not registering the package prior to this PR change.

  • Ensure that Repair also installs the winget-cli source package

    Added a "best effort" approach to programmatically attempt to downloading the source2.msix and install it.

  • Fix Win32Exception An error occurred trying to start process 'winget.exe' error the first time Repair -AllUsers is run

    Keeping this as-is since the code includes a descriptive message. In my repro, the issue occurred when App Installer was not installed, and the code attempted to invoke winget.exe to check if the application was present.

  • Repair -Force should bypass checks and attempt to install everything

    This is not addressed in this PR. It's unclear which constraints should be relaxed, as the current implementation already attempts to ensure the requested parameters are satisfied. The Force flag is currently used to trigger ForceTargetApplicationShutdown during package addition, which appears appropriate. I recommend opening a separate issue to propose and discuss the desired behavior.

  • I'd like to be able to use Repair-WinGetPackageManager -Version 1.11.* to get the latest version of WinGet 1.11 that is not a pre-release version.

    Added support for leading and trailing wildcard: 1.2.*, 1.2*, 1.*2.3

Related issues:

Microsoft Reviewers: Open in CodeFlow

@AmelBawa-msft AmelBawa-msft marked this pull request as ready for review September 9, 2025 19:51
/// <param name="includePrerelease">Include prerelease versions.</param>
/// <param name="result">The resulting version.</param>
/// <returns>True if a matching version was found.</returns>
private static bool TryGetLatestMatchingVersion(IEnumerable<WinGetVersion> versions, string pattern, bool includePrerelease, out WinGetVersion result)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static bool TryGetLatestMatchingVersion(IEnumerable<WinGetVersion> versions, string pattern, bool includePrerelease, out WinGetVersion result)
private static bool TryGetLatestMatchingVersion(IEnumerable<WinGetVersion> versions, string pattern, bool includePrerelease, out WinGetVersion? result)

Because you very clearly return a null in some cases. You can annotate with the appropriate attribute to mark it as not null when returning true.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was that you would use the NotNullWhen attribute and not need the ! inside the conditional.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also remove the ! from the null! in the function now.

@AmelBawa-msft AmelBawa-msft requested a review from a team as a code owner January 8, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants